<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
	String basePath = path + request.getContextPath() + "/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="layui/css/layui.css">
<script src="layui/layui.js"></script>
<script src="js/jquery.min.js"></script>
</head>
<body>
	<div>
		name:<input type="text" name="" id="staffname">
		<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" onclick="reload002();">确定</button>
		<a href="system/add.jsp">新增</a>
	</div>	
	<table id="attendTable">
	</table>
	<script type="text/javascript">
		function reload002(){
			layui.table.reload('attendTable',{
				where:{
					staffname:$('#staffname').val()
				},
				page:{
					curr:1
				}
			});
		}
		layui.use('table',function(){
			var table = layui.table;
			/* 手动渲染 */
			table.render({
				elem:'#attendTable',
				url:'Attendence/list',
				page:true,
				cols: [[ //表头
					   {checkbox: true},
				       {field: 'attendid', title: 'ID', width:80, sort: true}
				      ,{field: 'sex', title: 'sex', width:80, sort: true}
				      ,{field: 'staffname', title: 'staffname', width:113} 
				      ,{field: 'depatrment.deptname', title: 'deptname', width: 177,templet:function(d){
				    	 if(d.depatrment){/* 列格式化 */
				    		 return d.depatrment.deptname; 
				    	 }
				    	 return '无有';
				      }}
				      ,{field: 'attenddate', title: 'attenddate', width: 164, sort: true}
				      ,{field: 'attendin', title: 'attendin', width: 105, sort: true}
				      ,{field: 'attendout', title: 'attendout', width: 104}
				      ,{field: 'remark', title: 'remark'}
				      ]]
			})
		});
	</script>
</body>
</html>